<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
</head>

<body>
    <script src="/js/vue.js"></script>
    <div id="app">
        <h2>{{counter}}</h2>
        <cpn :child-counter="counter" @changr="childCounter"></cpn>
    </div>

    <template id="cpnT">
        <div>
            <button @click="increase">+</button>
            <button @click="decrease">-</button>
        </div>
    </template>
    <script>
        const cpn = {
            template: '#cpnT',
            prons:{
                childCounter:Number
            },
            data(){
                return {
                    dCounder: this.childCounter
                }
            },
            methods:{
                increase(){
                    this.dCounder++
                    this.$emit("chango",this.dCounder)
                },
                decrease(){
                    this.dCounder--
                    this.$emit("chango",this.dCounder)
                }
            }
        }

        let app = new Vue({
            el: "#app",
            data: {
                counter:0
            },
            components:{
                cpn
            },
            methods:{
                changTotal(value){

                }
            }
        })
    </script>
</body>

</html>